//
//  http_server.h
//  iphttpd
//
//  Created by Zhibiao Pan on 11-11-12.
//  Copyright 2011年 PanZhibiao. All rights reserved.
//

#ifndef reco_server_http_server_h
#define reco_server_http_server_h

#include <arpa/inet.h>

#include <event.h>
#include <evhttp.h>

// HTTPServer
//
// usage:
//   HTTPServer s;
//   s.run(8080, 10);
//
class HTTPServer {
public:
  HTTPServer() {}
  ~HTTPServer() {}
  int run(const char *ip, int port, int nthreads,
          void (*cb)(struct evhttp_request *, void *));
protected:
  static void* Dispatch(void *arg);
  int BindSocket(in_addr_t ip,int port);
};


#endif
